//
//  WXPAmountExplainVC.m
//  额度说明- 详情
//
//  Created by wxp on 2025/3/8.
//

#import "WXPAmountExplainVC.h"

@interface WXPAmountExplainVC ()

@property (nonatomic, strong) WXPNavView * navView;
@property (nonatomic, strong) WXPCommonAgreementView * agreementView;
@property (nonatomic, strong) UIView * headerView;
@property (nonatomic, strong) UIImageView * imageMark;
@property (nonatomic, strong) UILabel * labelTitle;
@property (nonatomic, strong) UILabel * labelSubTitle;
@property (nonatomic, strong) UILabel * labelContent;

@end

@implementation WXPAmountExplainVC

#pragma mark - lazy
- (WXPNavView *)navView{
    if (!_navView) {
        _navView = [WXPNavView new];
        [_navView resetViewWithTitle:[GlobalMethod getAppName]];
    }
    return _navView;
}
- (WXPCommonAgreementView *)agreementView{
    if (!_agreementView) {
        _agreementView = [WXPCommonAgreementView new];
        _agreementView.centerXBottom = XY(SCREEN_WIDTH/2, SCREEN_HEIGHT-LEFT_MARDIN);
    }
    return _agreementView;
}
- (UIView *)headerView{
    if (!_headerView) {
        _headerView = [UIView new];
        _headerView.backgroundColor = [UIColor whiteColor];
        _headerView.width = self.tableView.width;
        _headerView.height = self.tableView.height-LEFT_MARDIN;
    }
    return _headerView;
}
- (UILabel *)labelTitle{
    if (!_labelTitle) {
        _labelTitle = [UILabel new];
        [GlobalMethod setLabel:_labelTitle widthLimit:0 isBold:true fontNum:12 textColor:COLOR_BLACK text:@"Ver descripción"];
    }
    return _labelTitle;
}
- (UIImageView *)imageMark{
    if (!_imageMark) {
        _imageMark = [UIImageView new];
        _imageMark.widthHeight = XY(14, 14);
        _imageMark.image = [UIImage imageNamed:@"icon-amount-explain"];
    }
    return _imageMark;
}
- (UILabel *)labelSubTitle{
    if (!_labelSubTitle) {
        _labelSubTitle = [UILabel new];
        [GlobalMethod setLabel:_labelSubTitle widthLimit:0 isBold:true fontNum:14 textColor:COLOR_BLACK text:@"Descripción de las cuotas："];
    }
    return _labelSubTitle;
}
- (UILabel *)labelContent{
    if (!_labelContent) {
        _labelContent = [UILabel new];
        _labelContent.numberOfLines = 0;
        _labelContent.lineSpace = 5;
        _labelContent.fontNum = 12;
        _labelContent.textColor = COLOR_CONTENT;
        [_labelContent fitTitle:@"Cuota utilizada = Solicitud de préstamo exitosa\nCuota congelada = Pedido en revisión y trámite de depósito\nCuota disponible = Cuota disponible para solicitar préstamo." variable:self.headerView.width-LEFT_MARDIN*2];
    }
    return _labelContent;
}

#pragma mark - viewDidLoad
- (void)viewDidLoad {
    [super viewDidLoad];
    [self configUI];
}

- (void)configUI{
    self.viewBG.backgroundColor = COLOR_BACKGROUND;
    self.tableView.backgroundColor = [UIColor clearColor];
    self.navView.leftTop = XY(0, 0);
    [self.view addSubview:self.navView];
    [self.view addSubview:self.agreementView];
    
    self.tableView.width = SCREEN_WIDTH-LEFT_MARDIN*2;
    self.tableView.height = self.agreementView.top-self.navView.bottom;
    self.tableView.centerX = SCREEN_WIDTH/2;
    [GlobalMethod setRoundView:self.tableView color:[UIColor clearColor] numRound:16 width:0];
    
    self.labelTitle.leftTop = XY(LEFT_MARDIN, 20);
    [self.headerView addSubview:self.labelTitle];
    
    self.imageMark.leftCenterY = XY(self.labelTitle.right+10, self.labelTitle.centerY);
    [self.headerView addSubview:self.imageMark];
    
    self.labelSubTitle.leftTop = XY(self.labelTitle.left, self.labelTitle.bottom+26);
    [self.headerView addSubview:self.labelSubTitle];
    
    self.labelContent.leftTop = XY(self.labelTitle.left, self.labelSubTitle.bottom+12);
    [self.headerView addSubview:self.labelContent];
    [GlobalMethod setRoundView:self.headerView color:[UIColor clearColor] numRound:16 width:0];
    
    self.tableView.tableHeaderView = self.headerView;
    UIEdgeInsets inset = UIEdgeInsetsMake(LEFT_MARDIN, 0, 0, 0);
    self.tableView.contentInset = inset;
}



@end
